﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using POC.Loggers.Model;
using System.Data;
using System.Collections.Generic;
using POC.Reports.Document;
using POC.Azure.Model;

namespace RandomTester
{
    public class MyNewClass
    {
        public string ID { get; set; }
        public string Name { get; set; }
        MyNewClass()
        {
            ID = Guid.NewGuid().ToString();
            Name = "I am in " + DateTime.Now;
        }
        public static List<MyNewClass> CreateList()
        {
            List<MyNewClass> mores = new List<MyNewClass>();
            mores.Add(new MyNewClass() { });
            return mores;
        }
    }
   
    [TestClass]
    [Ignore]
    public class RandomUnitTest
    {
            [Ignore]
        [TestMethod]
        public void CreateDataSetFromLogEntry()
        {
            LogEntry entry1 = new LogEntry("This is not an exceptions, but some info for developer", "Information");
            //entry1.Fill();
            LogEntry entry2 = new LogEntry("This is an Error, some developer would like to hide it", "Error");
            //entry2.Fill();
            List<LogEntry> entries = new List<LogEntry>();
            entries.Add(entry1);
            entries.Add(entry2);
            var all = new List<object>(entries);
            DataTable dt = all.ToTable();
            string excelfile2 = @"c:\Logs\newtab-cool-" + DateTime.Now.Ticks + ".xlsx";
            dt.ToXLS(excelfile2);
        }
        [TestMethod]
        public void CreateDataSetFromLogEntryWithSomeColumns()
        {
            LogEntry entry1 = new LogEntry("This is not an exceptions, but some info for developer", "Information");
            //entry1.Fill();
            LogEntry entry2 = new LogEntry("This is an Error, some developer would like to hide it", "Error");
            //entry2.Fill();
            List<LogEntry> entries = new List<LogEntry>();
            entries.Add(entry1);
            entries.Add(entry2);
            string[] headers = new string[] { "EventID", "Message" };
            var all = new List<object>(entries);
            DataTable dt = all.ToTable(headers);         
            string excelfile2 = @"c:\Logs\newtab-cool-" + DateTime.Now.Ticks + ".xlsx";
            dt.ToXLS(excelfile2);
        }
        [Ignore]
        [TestMethod]
        public void CreateDataSetFromAnyObjects()
        {
            List<MyNewClass> mores = MyNewClass.CreateList();
            var all = new List<object>(mores);
            DataTable dt = all.ToTable();
            string excelfile2 = @"c:\Logs\newtab-cool-" + DateTime.Now.Ticks + ".xlsx";
            dt.ToXLS(excelfile2);
        }
    }
}
